package com.dynamixsoftware.printershare.smb;

import java.io.UnsupportedEncodingException;
import java.util.Date;

class Trans2FindFirst2Response
  extends SmbComTransactionResponse
{
  private int eaErrorOffset;
  boolean isEndOfSearch;
  String lastName;
  private int lastNameBufferIndex;
  private int lastNameOffset;
  int resumeKey;
  int sid;
  
  Trans2FindFirst2Response()
  {
    this.command = 50;
    this.subCommand = 1;
  }
  
  private String readString(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    try
    {
      if (this.useUnicode) {
        return new String(paramArrayOfByte, paramInt1, paramInt2, "UTF-16LE");
      }
      if ((paramInt2 > 0) && (paramArrayOfByte[(-1 + (paramInt1 + paramInt2))] == 0)) {
        paramInt2--;
      }
      String str = new String(paramArrayOfByte, paramInt1, paramInt2, "ISO-8859-1");
      return str;
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
    return null;
  }
  
  int readDataWireFormat(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    this.lastNameBufferIndex = (paramInt1 + this.lastNameOffset);
    this.results = new SmbFindFileBothDirectoryInfo[this.numEntries];
    for (int i = 0; i < this.numEntries; i++)
    {
      FileEntry[] arrayOfFileEntry = this.results;
      SmbFindFileBothDirectoryInfo localSmbFindFileBothDirectoryInfo = new SmbFindFileBothDirectoryInfo(null);
      arrayOfFileEntry[i] = localSmbFindFileBothDirectoryInfo;
      SmbFindFileBothDirectoryInfo.access$102(localSmbFindFileBothDirectoryInfo, readInt4(paramArrayOfByte, paramInt1));
      SmbFindFileBothDirectoryInfo.access$202(localSmbFindFileBothDirectoryInfo, readInt4(paramArrayOfByte, paramInt1 + 4));
      SmbFindFileBothDirectoryInfo.access$302(localSmbFindFileBothDirectoryInfo, readTime(paramArrayOfByte, paramInt1 + 8));
      SmbFindFileBothDirectoryInfo.access$402(localSmbFindFileBothDirectoryInfo, readTime(paramArrayOfByte, paramInt1 + 24));
      SmbFindFileBothDirectoryInfo.access$502(localSmbFindFileBothDirectoryInfo, readInt8(paramArrayOfByte, paramInt1 + 40));
      SmbFindFileBothDirectoryInfo.access$602(localSmbFindFileBothDirectoryInfo, readInt4(paramArrayOfByte, paramInt1 + 56));
      SmbFindFileBothDirectoryInfo.access$702(localSmbFindFileBothDirectoryInfo, readInt4(paramArrayOfByte, paramInt1 + 60));
      SmbFindFileBothDirectoryInfo.access$802(localSmbFindFileBothDirectoryInfo, readString(paramArrayOfByte, paramInt1 + 94, localSmbFindFileBothDirectoryInfo.fileNameLength));
      if ((this.lastNameBufferIndex >= paramInt1) && ((localSmbFindFileBothDirectoryInfo.nextEntryOffset == 0) || (this.lastNameBufferIndex < paramInt1 + localSmbFindFileBothDirectoryInfo.nextEntryOffset)))
      {
        this.lastName = localSmbFindFileBothDirectoryInfo.filename;
        this.resumeKey = localSmbFindFileBothDirectoryInfo.fileIndex;
      }
      paramInt1 += localSmbFindFileBothDirectoryInfo.nextEntryOffset;
    }
    return this.dataCount;
  }
  
  int readParametersWireFormat(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    int i = 1;
    int j = paramInt1;
    if (this.subCommand == i)
    {
      this.sid = readInt2(paramArrayOfByte, paramInt1);
      paramInt1 += 2;
    }
    this.numEntries = readInt2(paramArrayOfByte, paramInt1);
    int k = paramInt1 + 2;
    if ((0x1 & paramArrayOfByte[k]) == i) {}
    for (;;)
    {
      this.isEndOfSearch = i;
      int m = k + 2;
      this.eaErrorOffset = readInt2(paramArrayOfByte, m);
      int n = m + 2;
      this.lastNameOffset = readInt2(paramArrayOfByte, n);
      return n + 2 - j;
      i = 0;
    }
  }
  
  int readSetupWireFormat(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    return 0;
  }
  
  public String toString()
  {
    if (this.subCommand == 1) {}
    for (String str = "Trans2FindFirst2Response[";; str = "Trans2FindNext2Response[") {
      return new String(str + super.toString() + ",sid=" + this.sid + ",searchCount=" + this.numEntries + ",isEndOfSearch=" + this.isEndOfSearch + ",eaErrorOffset=" + this.eaErrorOffset + ",lastNameOffset=" + this.lastNameOffset + ",lastName=" + this.lastName + "]");
    }
  }
  
  int writeDataWireFormat(byte[] paramArrayOfByte, int paramInt)
  {
    return 0;
  }
  
  int writeParametersWireFormat(byte[] paramArrayOfByte, int paramInt)
  {
    return 0;
  }
  
  int writeSetupWireFormat(byte[] paramArrayOfByte, int paramInt)
  {
    return 0;
  }
  
  private class SmbFindFileBothDirectoryInfo
    implements FileEntry
  {
    private long allocationSize;
    private long changeTime;
    private long creationTime;
    private int eaSize;
    private long endOfFile;
    private int extFileAttributes;
    private int fileIndex;
    private int fileNameLength;
    private String filename;
    private long lastAccessTime;
    private long lastWriteTime;
    private int nextEntryOffset;
    private String shortName;
    private int shortNameLength;
    
    private SmbFindFileBothDirectoryInfo() {}
    
    public long createTime()
    {
      return this.creationTime;
    }
    
    public int getAttributes()
    {
      return this.extFileAttributes;
    }
    
    public String getName()
    {
      return this.filename;
    }
    
    public int getType()
    {
      return 1;
    }
    
    public long lastModified()
    {
      return this.lastWriteTime;
    }
    
    public long length()
    {
      return this.endOfFile;
    }
    
    public String toString()
    {
      return new String("SmbFindFileBothDirectoryInfo[nextEntryOffset=" + this.nextEntryOffset + ",fileIndex=" + this.fileIndex + ",creationTime=" + new Date(this.creationTime) + ",lastAccessTime=" + new Date(this.lastAccessTime) + ",lastWriteTime=" + new Date(this.lastWriteTime) + ",changeTime=" + new Date(this.changeTime) + ",endOfFile=" + this.endOfFile + ",allocationSize=" + this.allocationSize + ",extFileAttributes=" + this.extFileAttributes + ",fileNameLength=" + this.fileNameLength + ",eaSize=" + this.eaSize + ",shortNameLength=" + this.shortNameLength + ",shortName=" + this.shortName + ",filename=" + this.filename + "]");
    }
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.smb.Trans2FindFirst2Response
 * JD-Core Version:    0.7.0.1
 */